<?php
namespace Home\Model;
use Think\Model;

/**
* Created by hanquan.
* User partner
* Date 2017/04/07
* Time 14:39
* RegionModel 地区模型类
*/
class RegionModel extends Model{
	
	private $Region = null;
	function __construct(){
		$this->Region = M('Region');
	}

	/**
	 * get_region 查询地区列表
	 * @param int $city_id 城市id
	 * @return array 一维数组
	 */
	public function get_region($city_id){
		$condition['city_id'] = $city_id;
		return $this->Region->where($condition)->select();
	}

	/**
	 * set_region 插入地区
	 * @param array $data 地区数据
	 */
	public function set_region($data){
		return $this->Region->add($data);
	}

	/**
	 * 删除地区
	 * @param  int $re_id 地区id
	 * @return boolean
	 */
	public function del_region($re_id){
		$condition['re_id'] = $re_id;
		return $this->Region->where($condition)->delete();
	}
}